import React, { useState, useEffect } from 'react'
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'
import LoadingPage from './components/LoadingPage'
import HomePage from './pages/HomePage'
import AIJingGePage from './pages/AIJingGePage'
import InteractivePage from './pages/InteractivePage'
import CommunityPage from './pages/CommunityPage'
import Navigation from './components/Navigation'
import CreatorCenter from './components/CreatorCenter'
import ScriptEditor from './components/ScriptEditor'
import CreatorCertification from './components/CreatorCertification'
import TheaterVision from './components/TheaterVision'
import UserCenter from './pages/UserCenter'

function App() {
  const [isLoading, setIsLoading] = useState(true)

  useEffect(() => {
    // 模拟加载时间
    const timer = setTimeout(() => {
      setIsLoading(false)
    }, 3000)

    return () => clearTimeout(timer)
  }, [])

  if (isLoading) {
    return <LoadingPage />
  }

  return (
    <Router>
      <div className="min-h-screen bg-gradient-to-br from-mo-hei via-zhu-hong/20 to-shi-qing/20">
        <Navigation />
        <Routes>
          <Route path="/" element={<HomePage />} />
          <Route path="/ai-jingge" element={<AIJingGePage />} />
          <Route path="/interactive" element={<InteractivePage />} />
          <Route path="/community" element={<CommunityPage />} />
          <Route path="/creator" element={<CreatorCenter />} />
          <Route path="/script-editor" element={<ScriptEditor />} />
          <Route path="/certification" element={<CreatorCertification />} />
          <Route path="/theater-vision" element={<TheaterVision />} />
          <Route path="/user-center" element={<UserCenter />} />
        </Routes>
      </div>
    </Router>
  )
}

export default App
